<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul th:object=${hatchetMerchant}>
							<!-- 隐藏表单 用来保存代理商id -->
							<li>
								经理人编号：<input type="text" name="merchantNo"/>
							</li>
							<li>
								经理人名称：<input type="text" name="merchantCnName"/>
							</li>
							<li>
								经理人电话：<input type="text" name="pHONE"/>
							</li>
							<li>
								经理人状态：<select name="isValid">
									<option value="">所有</option>
									<option value="10A">待审核</option>
									<option value="10B">审核通过</option>
									<option value="10C">审核不通过</option>
								</select>
							</li>
							<li class="select-time">
								<label>升级经理人时间： </label>
								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
								<span>-</span>
								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
							</li>
							
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
       var editFlag = [[${@permission.hasPermi('system:hatchetMerchant:edit')}]];
        /*var removeFlag = [[${@permission.hasPermi('system:hatchetMerchant:remove')}]]; */
        var prefix = ctx + "system/hatchetMerchant";
		var tableUrl = prefix + "/selectJLR";
        $(function() {
            var options = {
                url: tableUrl,
             /*    createUrl: prefix + "/add",
                removeUrl: prefix + "/remove", */
                updateUrl: prefix + "/editJLR/{id}",
				exportUrl: prefix + "/export",
                modalName: "客户列",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'merchantNo', 
					title : '客户编号',
					sortable: true
				},
				{
					field : 'merchantCnName', 
					title : '客户名称',
					sortable: true
				},
				{
					field : 'phone', 
					title : '手机号',
					sortable: true
				},
				{
					field : 'submitExamineTime', 
					title : '升级黄金会员时间',
					sortable: true
				},
				{
					field : 'submitReexamineTime', 
					title : '升级经纪人时间',
					sortable: true
				},
				{
					field : 'validTime', 
					title : '升级经理人时间',
					sortable: true
				},
				{
					field : 'isValid', 
					title : '经理人状态',
					formatter: function(value, row, index) {
		            	if(value=="10A"){
		            		return "待审核";
		            	} else if(value=="10B"){
		            		return "审核通过";
		            	} else if(value=="10C"){
		            		return "审核未通过";
		            	}
		            }
				},
				{
					field : 'upgradeCodeNum', 
					title : '升级码数量',
					sortable: true
				},
				{
					field : 'createTime', 
					title : '创建时间',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	if (row.isValid == "10A"){
		            	actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')">审核</a> ');
		            	}
						return actions.join('');
		            }
		        }]
            };

            $.table.init(options);
        });
        
        /* 客户状态-禁用 */
    	function forbidden(merchantId) {
    		$.modal.confirm("确认要禁用该客户？", function() {
    			$.operate.post(prefix + "/changeStatus", { "merchantId": merchantId });
    		   })
    	}
    	 /* 客户状态-开启*/
    	function opens(merchantId) {
    		$.modal.confirm("确认要开启该客户？", function() {
    			$.operate.post(prefix + "/changeStatus", { "merchantId": merchantId });
    		   })
    	}
    </script>
</body>
</html>